﻿/*----------------------------------------------------------------
//   Copyright (C) 2013 YMSOFT All rights reserved 
//
//   CLR版本:   2.0.50727.3643
//   Namespace: ALSCrm
//   FileName : RndCode
//   Description: 
// 
//   Created by YAOMING at 2013-2-16 17:25:58
//   http://www.loverer.com QQ:78867011
//
//   Modified: 
//   Modify description: 
//
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ART.Common.RandCode;

namespace ART
{
    public partial class RndCode : System.Web.UI.Page
    {
protected void Page_Load(object sender, EventArgs e)
        {
            Response.BufferOutput = true;    //缓冲输出
            Response.Cache.SetExpires(DateTime.Now.AddMilliseconds(-1));
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.AppendHeader("Pragma", "No-Cache");
            int dint = 0;
            bool t =int.TryParse(base.Request.QueryString["t"].ToString(), out dint);
            CreateRnd(dint);

        }

        private void CreateRnd(int t)
        {
            Random random = new Random();
            int v = t;
            if (v == 0)
            {
                v = random.Next(1, 5);
            }
            switch (v)
            {
                case 1:
                    PicCode.CreateImage(4);
                    break;
                case 2:
                    ChineseCode.CreateImage(3);
                    break;
                case 3:
                    NumberCode.CreateImage();
                    break;
                case 4:
                    GoogleCode.CreateImage(4);
                    break;
            }
        }
    }
}

